<!DOCTYPE html>
<head>
<link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" />
<script defer src="https://pyscript.net/alpha/pyscript.js"></script>
</head>
<body>
<py-script>
print("Hello World")
</py-script>
</body>
</html>
Tutorial:
https://blog.finxter.com/how-to-embed-a-python-interpreter-in-your-website/